﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using 聚欣订单分析.Ling;

namespace 聚欣订单分析.Borrow
{
    public partial class BorrowInfo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["qx"] != null)
            {
                if (Session["qtqx"].ToString().IndexOf("借货") <= 0)
                {
                    this.ASPxGridView1.Columns["金额"].Visible = false;
                    this.ASPxGridView1.Columns["利息"].Visible = false;
                }
            }
            else
            {
                Response.Redirect("../login.aspx");
            }
        }

        protected void btnExcel_Click(object sender, EventArgs e)
        {
            ASPxGridViewExporter1.WriteXlsxToResponse("BorrowInfo");
        }

        protected void LinqServerModeDataSource1_Selecting(object sender, DevExpress.Data.Linq.LinqServerModeDataSourceSelectEventArgs e)
        {
            if (Session["qx"].ToString() != "3" && Session["qx"].ToString() != "0")
            {
                tbl_JHDataContext JHDC = new tbl_JHDataContext();
                if (Session["Qy"] != null)
                {
                    if (Session["Qy"].ToString() != "")
                    {
                        e.QueryableSource = from t in JHDC.v_JHWP where Session["Qy"].ToString().Split(',').Contains(t.区域) select t;
                    }
                }
                else
                {
                    e.QueryableSource = from t in JHDC.v_JHWP where 1 != 1 select t;
                }
                e.KeyExpression = "ID";
            }
        }
    }
}